package com.jsgt.greekfire.ui.pool.transfercoin



import android.widget.ArrayAdapter
import android.widget.PopupMenu
import android.widget.RadioGroup
import androidx.fragment.app.FragmentTransaction
import com.fhx.core.base.BaseActivity
import com.jsgt.greekfire.R
import com.jsgt.greekfire.ui.pool.transfercoin.fragment.ChangeIntoFragment
import com.jsgt.greekfire.ui.pool.transfercoin.fragment.TransferOutFragment
import kotlinx.android.synthetic.main.activity_transfer_coin1.*
import kotlinx.android.synthetic.main.view_transfer_in.*


class TransferCoinActivity1 : BaseActivity() {


    private var popupMenu: PopupMenu? = null

    override fun getLayoutId(): Int = R.layout.activity_transfer_coin1


    override fun main() {

        back.setOnClickListener {
            finish()
        }


        transfer_out.isChecked = true
        val  fragmentManager: androidx.fragment.app.FragmentManager = getSupportFragmentManager();
        val transaction: FragmentTransaction = fragmentManager.beginTransaction()
        transaction.replace(R.id.fl_content, TransferOutFragment())
        transaction.commit()

        //RadioGroup的check事件，来实现Fragment的切换
        radio_group.setOnCheckedChangeListener(RadioGroup.OnCheckedChangeListener { group, checkedId ->
            val transaction = fragmentManager.beginTransaction()
            //根据RadioButton不同的Id来选中不同的Fragment。
            if (checkedId == R.id.transfer_out) {
                transaction.replace(R.id.fl_content, TransferOutFragment(),"0")
            } else if (checkedId == R.id.change_info) {
                transaction.replace(R.id.fl_content, ChangeIntoFragment() ,"1")
            }
            transaction.commit()
        })




    }
}

